<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    Promise.MyAll=function (list=[]){
      return new Promise((reslove,resject)=>{
        list.forEach((item,index)=>{
          item.then(res=>{
            reslove(res)
          },err=>{
            resject(err)
          })
        })
      })
    }

   const p1=new Promise((reslove,resject)=>{
      setTimeout(()=>{
        resject('aaa')
      },5000)
    })
    const p2=new Promise((reslove,resject)=>{
      setTimeout(()=>{
        reslove('bbb')
      },3000)
    })
    const p3=new Promise((reslove,resject)=>{
      setTimeout(()=>{
        reslove('ccc')
      },2000)
    })

    
    
    Promise.MyAll([p1,p2,p3]).then(res=>{
      console.log(res);
    },
    (err)=>{
      console.log(err);
    }
    )
  </script>
</body>
</html>